package com.chaopei.account_mng.service.impl;

import com.chaopei.account_mng.service.MQConsumerService;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Service;

/**
 * @Author Corday 天涯
 * @Date 2022/5/12 15:25
 */
@Service
public class MQConsumerServiceImpl implements MQConsumerService {
    /**
     *消息监听器,自动启动，一直监听
     * @param msg
     * @return
     */
    @JmsListener(destination = "tom.mq")
    @Override
    public void getMessage(String msg) {
        System.out.println("拿到消息："+msg);
        //执行其它的业务,比如更新数据库
    }
    @JmsListener(destination ="tom.mq")
    public void getMsg(String msg){
        //拿到消息后，要去做其它更多的事情,比如：更新redis缓存中的数据
        System.out.println("我也拿："+msg);
    }
}
